/*eslint-disable*/
/**
 * 如有需要添加的属性,在里边追加,配置参考ant-input
 * 配合form表单一起使用
 */
import React from 'react';
import {
  Input,
  Form
} from 'antd';
import { SearchOutlined } from '@ant-design/icons';
import styles from './index.module.less';

const InputComponent = ({
  placeholder,
  label,
  disabled,
  name,
  search, //需要搜索icon
  value,
  onChange,
  initialValue,
  required,
  rules,
  style,
  ...props
}) => (
  <div style={style} className={styles.InputCom}>
    <Form.Item
      label={label}
      name={name}
      initialValue={initialValue}
      required={required}
      rules={rules}
    >
      <Input
        maxLength={128}
        value={value}
        disabled={!!disabled}
        onChange={(e) => { onChange && onChange(e.currentTarget.value) }}
        suffix={search && <SearchOutlined style={{ color: '#99ACC5' }} />}
        placeholder={placeholder}
        {...props}
      />
    </Form.Item>
  </div>
);

export default InputComponent;
